<!-- HTML header for doxygen 1.8.8-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <!-- For Mobile Devices -->
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
        <meta name="generator" content="Doxygen 1.8.18"/>
        <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
        <title>HElib: /HElib/include/helib/PolyModRing.h Source File</title>
        <!--<link href="tabs.css" rel="stylesheet" type="text/css"/>-->
        <script type="text/javascript" src="dynsections.js"></script>
        <link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
        <link href='https://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
		<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,100;1,700&family=Merriweather&family=Merriweather+Sans&family=Open+Sans&family=Poppins:ital@1&family=Roboto:ital,wght@0,400;1,300;1,900&display=swap" rel="stylesheet"> 
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
        <link href="jquery.smartmenus.bootstrap.css" rel="stylesheet">
        <script type="text/javascript" src="jquery.smartmenus.js"></script>
        <!-- SmartMenus jQuery Bootstrap Addon -->
        <script type="text/javascript" src="jquery.smartmenus.bootstrap.js"></script>
        <!-- SmartMenus jQuery plugin -->
    </head>
    <body style="font-family: 'Merriweather', serif;">
        <nav class="navbar navbar-default" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <a class="navbar-brand">HElib Implementing Homomorphic Encryption</a>
                </div>
            </div>
        </nav>
        <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
            <div class="content" id="content">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-12 panel " style="padding-bottom: 15px;">
                            <div style="margin-bottom: 15px;">
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_d0c4ae63660968bf6b1c77a1e8aecf95.html">helib</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">PolyModRing.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_poly_mod_ring_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/* Copyright (C) 2019 IBM Corp.</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * This program is Licensed under the Apache License, Version 2.0</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * (the &quot;License&quot;); you may not use this file except in compliance</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * with the License. You may obtain a copy of the License at</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> *   http://www.apache.org/licenses/LICENSE-2.0</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * Unless required by applicable law or agreed to in writing, software</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> * See the License for the specific language governing permissions and</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> * limitations under the License. See accompanying LICENSE file.</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160; </div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;NTL/ZZX.h&gt;</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &lt;NTL/ZZ_p.h&gt;</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160; </div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor">#ifndef HELIB_POLYMODRING_H</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor">#define HELIB_POLYMODRING_H</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160; </div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacehelib.html">helib</a> {</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160; </div>
<div class="line"><a name="l00042"></a><span class="lineno"><a class="line" href="structhelib_1_1_poly_mod_ring.html">   42</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structhelib_1_1_poly_mod_ring.html">PolyModRing</a></div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;{</div>
<div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="structhelib_1_1_poly_mod_ring.html#a53fef893b5100a61915e34139f25a443">   47</a></span>&#160;  <span class="keyword">const</span> <span class="keywordtype">long</span> <a class="code" href="structhelib_1_1_poly_mod_ring.html#a53fef893b5100a61915e34139f25a443">p</a>;</div>
<div class="line"><a name="l00051"></a><span class="lineno"><a class="line" href="structhelib_1_1_poly_mod_ring.html#ab3f2d53747afa3845d079dc5d7f8bca7">   51</a></span>&#160;  <span class="keyword">const</span> <span class="keywordtype">long</span> <a class="code" href="structhelib_1_1_poly_mod_ring.html#ab3f2d53747afa3845d079dc5d7f8bca7">r</a>;</div>
<div class="line"><a name="l00056"></a><span class="lineno"><a class="line" href="structhelib_1_1_poly_mod_ring.html#a7f63d79df9e938c2f8cace891a619b94">   56</a></span>&#160;  <span class="keyword">const</span> NTL::ZZX <a class="code" href="structhelib_1_1_poly_mod_ring.html#a7f63d79df9e938c2f8cace891a619b94">G</a>;</div>
<div class="line"><a name="l00060"></a><span class="lineno"><a class="line" href="structhelib_1_1_poly_mod_ring.html#aaeb79e9dc6bb265aa214926242573a5d">   60</a></span>&#160;  <span class="keyword">const</span> <span class="keywordtype">long</span> <a class="code" href="structhelib_1_1_poly_mod_ring.html#aaeb79e9dc6bb265aa214926242573a5d">p2r</a>;</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160; </div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;  <span class="comment">// Delete the default constructor.</span></div>
<div class="line"><a name="l00063"></a><span class="lineno"><a class="line" href="structhelib_1_1_poly_mod_ring.html#acdee8a99a4366ac200eb952270c443d5">   63</a></span>&#160;  <a class="code" href="structhelib_1_1_poly_mod_ring.html#acdee8a99a4366ac200eb952270c443d5">PolyModRing</a>() = <span class="keyword">delete</span>;</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160; </div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;  <span class="comment">// Delete the assignment operators.</span></div>
<div class="line"><a name="l00066"></a><span class="lineno"><a class="line" href="structhelib_1_1_poly_mod_ring.html#a964aef6ec7190568163c8ed93ecf4772">   66</a></span>&#160;  <a class="code" href="structhelib_1_1_poly_mod_ring.html">PolyModRing</a>&amp; <a class="code" href="structhelib_1_1_poly_mod_ring.html#a964aef6ec7190568163c8ed93ecf4772">operator=</a>(<span class="keyword">const</span> <a class="code" href="structhelib_1_1_poly_mod_ring.html">PolyModRing</a>&amp;) = <span class="keyword">delete</span>;</div>
<div class="line"><a name="l00067"></a><span class="lineno"><a class="line" href="structhelib_1_1_poly_mod_ring.html#af1295ad6567d80ced4d57938c03991ae">   67</a></span>&#160;  <a class="code" href="structhelib_1_1_poly_mod_ring.html">PolyModRing</a>&amp; <a class="code" href="structhelib_1_1_poly_mod_ring.html#af1295ad6567d80ced4d57938c03991ae">operator=</a>(<a class="code" href="structhelib_1_1_poly_mod_ring.html">PolyModRing</a>&amp;&amp;) = <span class="keyword">delete</span>;</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160; </div>
<div class="line"><a name="l00072"></a><span class="lineno"><a class="line" href="structhelib_1_1_poly_mod_ring.html#ad5f900826cac926940bd38a749df93eb">   72</a></span>&#160;  <a class="code" href="structhelib_1_1_poly_mod_ring.html#ad5f900826cac926940bd38a749df93eb">PolyModRing</a>(<span class="keyword">const</span> <a class="code" href="structhelib_1_1_poly_mod_ring.html">PolyModRing</a>&amp; other) = <span class="keywordflow">default</span>;</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160; </div>
<div class="line"><a name="l00077"></a><span class="lineno"><a class="line" href="structhelib_1_1_poly_mod_ring.html#a96c7a49fab96cb8c1e322d01804d8b88">   77</a></span>&#160;  <a class="code" href="structhelib_1_1_poly_mod_ring.html#a96c7a49fab96cb8c1e322d01804d8b88">PolyModRing</a>(<a class="code" href="structhelib_1_1_poly_mod_ring.html">PolyModRing</a>&amp;&amp; other) = <span class="keywordflow">default</span>;</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160; </div>
<div class="line"><a name="l00082"></a><span class="lineno"><a class="line" href="structhelib_1_1_poly_mod_ring.html#a2175edd6ede241f3a6408b9d169e51bc">   82</a></span>&#160;  <a class="code" href="structhelib_1_1_poly_mod_ring.html#a2175edd6ede241f3a6408b9d169e51bc">~PolyModRing</a>() = <span class="keywordflow">default</span>;</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160; </div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;  <a class="code" href="structhelib_1_1_poly_mod_ring.html#acdee8a99a4366ac200eb952270c443d5">PolyModRing</a>(<span class="keywordtype">long</span> <a class="code" href="structhelib_1_1_poly_mod_ring.html#a53fef893b5100a61915e34139f25a443">p</a>, <span class="keywordtype">long</span> <a class="code" href="structhelib_1_1_poly_mod_ring.html#ab3f2d53747afa3845d079dc5d7f8bca7">r</a>, <span class="keyword">const</span> NTL::ZZX&amp; <a class="code" href="structhelib_1_1_poly_mod_ring.html#a7f63d79df9e938c2f8cace891a619b94">G</a>);</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160; </div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="structhelib_1_1_poly_mod_ring.html#adeff8357a93b397153b7ebf94ecaa2e2">operator==</a>(<span class="keyword">const</span> <a class="code" href="structhelib_1_1_poly_mod_ring.html">PolyModRing</a>&amp; rhs) <span class="keyword">const</span> noexcept;</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160; </div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="structhelib_1_1_poly_mod_ring.html#a585750c250ac48fd9a2b06ec5f754d5e">operator!=</a>(<span class="keyword">const</span> <a class="code" href="structhelib_1_1_poly_mod_ring.html">PolyModRing</a>&amp; rhs) <span class="keyword">const</span> noexcept;</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160; </div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;  <span class="keyword">friend</span> std::ostream&amp; <a class="code" href="structhelib_1_1_poly_mod_ring.html#a1a9143aaf25751dbc3c9bc8eb96ae586">operator&lt;&lt;</a>(std::ostream&amp; os, <span class="keyword">const</span> <a class="code" href="structhelib_1_1_poly_mod_ring.html">PolyModRing</a>&amp; ring);</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;};</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;} <span class="comment">// namespace helib</span></div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160; </div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;<span class="preprocessor">#endif // HELIB_POLYMODRING_H</span></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="astructhelib_1_1_poly_mod_ring_html"><div class="ttname"><a href="structhelib_1_1_poly_mod_ring.html">helib::PolyModRing</a></div><div class="ttdoc">Lightweight type for describing the structure of a single slot of the plaintext space.</div><div class="ttdef"><b>Definition:</b> PolyModRing.h:43</div></div>
<div class="ttc" id="astructhelib_1_1_poly_mod_ring_html_a96c7a49fab96cb8c1e322d01804d8b88"><div class="ttname"><a href="structhelib_1_1_poly_mod_ring.html#a96c7a49fab96cb8c1e322d01804d8b88">helib::PolyModRing::PolyModRing</a></div><div class="ttdeci">PolyModRing(PolyModRing &amp;&amp;other)=default</div><div class="ttdoc">Move constructor.</div></div>
<div class="ttc" id="astructhelib_1_1_poly_mod_ring_html_ab3f2d53747afa3845d079dc5d7f8bca7"><div class="ttname"><a href="structhelib_1_1_poly_mod_ring.html#ab3f2d53747afa3845d079dc5d7f8bca7">helib::PolyModRing::r</a></div><div class="ttdeci">const long r</div><div class="ttdoc">The power of p used in the plaintext space coefficient modulus.</div><div class="ttdef"><b>Definition:</b> PolyModRing.h:51</div></div>
<div class="ttc" id="astructhelib_1_1_poly_mod_ring_html_a964aef6ec7190568163c8ed93ecf4772"><div class="ttname"><a href="structhelib_1_1_poly_mod_ring.html#a964aef6ec7190568163c8ed93ecf4772">helib::PolyModRing::operator=</a></div><div class="ttdeci">PolyModRing &amp; operator=(const PolyModRing &amp;)=delete</div></div>
<div class="ttc" id="astructhelib_1_1_poly_mod_ring_html_a7f63d79df9e938c2f8cace891a619b94"><div class="ttname"><a href="structhelib_1_1_poly_mod_ring.html#a7f63d79df9e938c2f8cace891a619b94">helib::PolyModRing::G</a></div><div class="ttdeci">const NTL::ZZX G</div><div class="ttdoc">The irreducible factor of Phi_m(X) used for the algebra of the individual slots.</div><div class="ttdef"><b>Definition:</b> PolyModRing.h:56</div></div>
<div class="ttc" id="astructhelib_1_1_poly_mod_ring_html_aaeb79e9dc6bb265aa214926242573a5d"><div class="ttname"><a href="structhelib_1_1_poly_mod_ring.html#aaeb79e9dc6bb265aa214926242573a5d">helib::PolyModRing::p2r</a></div><div class="ttdeci">const long p2r</div><div class="ttdoc">The plaintext space coefficient modulus, equal to p^r.</div><div class="ttdef"><b>Definition:</b> PolyModRing.h:60</div></div>
<div class="ttc" id="astructhelib_1_1_poly_mod_ring_html_ad5f900826cac926940bd38a749df93eb"><div class="ttname"><a href="structhelib_1_1_poly_mod_ring.html#ad5f900826cac926940bd38a749df93eb">helib::PolyModRing::PolyModRing</a></div><div class="ttdeci">PolyModRing(const PolyModRing &amp;other)=default</div><div class="ttdoc">Copy constructor.</div></div>
<div class="ttc" id="astructhelib_1_1_poly_mod_ring_html_af1295ad6567d80ced4d57938c03991ae"><div class="ttname"><a href="structhelib_1_1_poly_mod_ring.html#af1295ad6567d80ced4d57938c03991ae">helib::PolyModRing::operator=</a></div><div class="ttdeci">PolyModRing &amp; operator=(PolyModRing &amp;&amp;)=delete</div></div>
<div class="ttc" id="anamespacehelib_html"><div class="ttname"><a href="namespacehelib.html">helib</a></div><div class="ttdef"><b>Definition:</b> apiAttributes.h:21</div></div>
<div class="ttc" id="astructhelib_1_1_poly_mod_ring_html_a585750c250ac48fd9a2b06ec5f754d5e"><div class="ttname"><a href="structhelib_1_1_poly_mod_ring.html#a585750c250ac48fd9a2b06ec5f754d5e">helib::PolyModRing::operator!=</a></div><div class="ttdeci">bool operator!=(const PolyModRing &amp;rhs) const noexcept</div><div class="ttdoc">Not-equals operator.</div><div class="ttdef"><b>Definition:</b> PolyModRing.cpp:27</div></div>
<div class="ttc" id="astructhelib_1_1_poly_mod_ring_html_acdee8a99a4366ac200eb952270c443d5"><div class="ttname"><a href="structhelib_1_1_poly_mod_ring.html#acdee8a99a4366ac200eb952270c443d5">helib::PolyModRing::PolyModRing</a></div><div class="ttdeci">PolyModRing()=delete</div></div>
<div class="ttc" id="astructhelib_1_1_poly_mod_ring_html_a1a9143aaf25751dbc3c9bc8eb96ae586"><div class="ttname"><a href="structhelib_1_1_poly_mod_ring.html#a1a9143aaf25751dbc3c9bc8eb96ae586">helib::PolyModRing::operator&lt;&lt;</a></div><div class="ttdeci">friend std::ostream &amp; operator&lt;&lt;(std::ostream &amp;os, const PolyModRing &amp;ring)</div><div class="ttdoc">Output shift operator.</div><div class="ttdef"><b>Definition:</b> PolyModRing.cpp:32</div></div>
<div class="ttc" id="astructhelib_1_1_poly_mod_ring_html_adeff8357a93b397153b7ebf94ecaa2e2"><div class="ttname"><a href="structhelib_1_1_poly_mod_ring.html#adeff8357a93b397153b7ebf94ecaa2e2">helib::PolyModRing::operator==</a></div><div class="ttdeci">bool operator==(const PolyModRing &amp;rhs) const noexcept</div><div class="ttdoc">Equality operator.</div><div class="ttdef"><b>Definition:</b> PolyModRing.cpp:22</div></div>
<div class="ttc" id="astructhelib_1_1_poly_mod_ring_html_a2175edd6ede241f3a6408b9d169e51bc"><div class="ttname"><a href="structhelib_1_1_poly_mod_ring.html#a2175edd6ede241f3a6408b9d169e51bc">helib::PolyModRing::~PolyModRing</a></div><div class="ttdeci">~PolyModRing()=default</div><div class="ttdoc">Destructor.</div></div>
<div class="ttc" id="astructhelib_1_1_poly_mod_ring_html_a53fef893b5100a61915e34139f25a443"><div class="ttname"><a href="structhelib_1_1_poly_mod_ring.html#a53fef893b5100a61915e34139f25a443">helib::PolyModRing::p</a></div><div class="ttdeci">const long p</div><div class="ttdoc">The characteristic of the plaintext space. This should be prime.</div><div class="ttdef"><b>Definition:</b> PolyModRing.h:47</div></div>
<!-- HTML footer for doxygen 1.8.8-->
<!-- start footer part -->
</div>
</div>
</div>
</div>
</div>
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
        <script type="text/javascript" src="doxy-boot.js"></script>
</html>
